<?php

namespace App\Http\Controllers;

use App\Models\Doctor;
use Illuminate\Http\Request;

class DoctorController extends Controller
{
    /**
     * Get the token array structure.
     *
     * @param  string $token
     *
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respondWithToken($token)
    {
        return response()->json([
            'access_token' => $token,
            'token_type' => 'bearer',
            'expires_in' => auth()->factory()->getTTL() * 60
        ]);
    }

    function doctorLogin(Request $request)
    {
        $oDoctor = Doctor::query()->first();
        // 手动认证用户
        $token = auth('doctor')->login($oDoctor);

        return ['token' => 'Bearer '.$token];
    }
}
